package com.mioto.ld.module.alert.model;

import cn.hutool.json.JSONConfig;
import cn.hutool.json.JSONUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * @author mioto-qinxj
 * @date 2024/5/21
 * @desc 定时任务触发条件
 */
@Getter
@Setter
@ApiModel(value = "定时任务触发条件对象")
public class TimedTriggerConditionDTO extends TriggerConditionDTO{

    @ApiModelProperty(value = "关机时间 02:20")
    private String time;
    @ApiModelProperty(value = "重复规则 星期一到星期天 对应1-7,多个选择用,隔开")
    private String repeatRule;

    @Override
    public String toJsonStr() {
        JSONConfig jsonConfig = new JSONConfig().setOrder(true);
        return JSONUtil.createObj(jsonConfig)
                .set("time",time)
                .set("repeatRule",repeatRule)
                .toString();
    }
}
